use bevy::prelude::*;
use bevy::window::{MonitorSelection, WindowMode};

#[bevy_main]
pub fn main() {
    App::new()
        .add_plugins((DefaultPlugins.set(WindowPlugin {
            primary_window: Some(Window {
                name: Some("Test Cargo Mobile2".to_string()),
                resizable: false,
                mode: WindowMode::BorderlessFullscreen(MonitorSelection::Current),
                ..default()
            }),
            ..default()
        }),))
        .add_systems(Startup, setup)
        .run();
}

fn setup(mut commands: Commands, asset_server: Res<AssetServer>) {
    let bevy_logo = asset_server.load("branding/icon.png");
    commands.spawn(Camera2d::default());
    commands.spawn(Sprite::from_image(bevy_logo));
}

#[unsafe(no_mangle)]
#[inline(never)]
#[cfg(target_os = "ios")]
pub extern "C" fn start_app() {
    main();
}
